[Root7] A path to reducing global memory management.#18083
[Root7] A path to reducing global memory management.#18083hageboeck wants to merge 14 commits intoroot-project:masterfrom
Conversation
89bd358 to
4d29c60
Compare
hist/hist/src/TH1.cxx
Outdated
| Bool_t TH1::AddDirectoryStatus() | ||
| { | ||
| return fgAddDirectory; | ||
| return !ROOT::ROOT7MemoryManagement() && fgAddDirectory; |
There was a problem hiding this comment.
Note that this flag is primarily about file constructions (and secondarily about shared ownership). Beside the (intentional) memory leak it introduces in existing scripts, it leads most of them to not longer write the histograms to the file (because they are no longer attached to the File). It is not clear whether this kind of approach is worth it compared to a more user active change (ie. Switching explicitly from TFile to RFile).
There was a problem hiding this comment.
Thanks for the information!
Details will be discussed on the ROOT retreat next week.
Test Results 22 files 22 suites 3d 4h 20m 18s ⏱️ For more details on these failures, see this check. Results for commit 3878984. ♻️ This comment has been updated with latest results. |
4d29c60 to
1224a4b
Compare
b894456 to
167c0cc
Compare
342a3cb to
0ca4f8a
Compare
0ca4f8a to
68de9c4
Compare
68de9c4 to
9c5ce87
Compare
9c5ce87 to
b79032e
Compare
74a6279 to
8d9511a
Compare
0b52df2 to
c9f787b
Compare
256881d to
d354941
Compare
Explicitly assign histograms to directories. In this way, the tests proceed irrespective of whether or not implicit object ownership is in use.
- Don't rely on implicit registration to directories. - Make the test insensitive to any defaults by always adding the histogram to the file.
When the implicit ownership is switched to ROOT 7 mode, the corresponding notification needs to be masked from output diffs and/or the RootTestDriver checks.
Since the ROOT 7 ownership settings affect TH1::AddDirectoryStatus, objects read from a TFile would not associate themselves with that file. This breaks TFile contracts which don't need to be broken, as a file interface that's always reading a fresh copy from disc is RFile. So, implicit ownership "off" affects whether new objects are associated to gDirectory, TH1::AddDirectoryStatus has the same effect as before (affecting both new objects and objects read from file), and RFile undoes or avoids any potential registration. Also update the documentation to better explain what this does.
- Add DisableImplicitObjectOwnership() and EnableImplicitObjectOwnership(). - Add a function to test if ownership is on or off. - Add a silentOff mode for running tests that check the program output. - Allow for setting defaults using - The environment variable ROOT_IMPLICIT_OWNERSHIP - The rootrc variable Root.ImplicitOwnership
…ived. - Couple TH1::AddDirectoryStatus to ROOT::DisableImplicitObjectOwnership. - Add a manual exception for TTree::Draw(): Histograms and profiles will still register themselves to gDirectory because the registration is an essential part of the feature.
…ect. It makes sense when a different object with the same name is registered (the old object will leak), but if the object is identical, the replacement is like a no-op.
Previously, gDirectory was used. By creating a local directory, the test has now side effects on gDirectory.
d354941 to
3878984
Compare
This is a longer-term effort to update ROOT to work both with implicit and explicit object ownership (i.e. whether THx and similar are owned by gDirectory). The branch started by switching off this ownership and fixing all failing tests. These fixes will be done in a way that the code works both with and without implicit ownership, and will be split off into other PRs to keep the review load manageable. Once that's done, the final names and implementations of the ownership-related functions will be decided here.
TODOs:
TH1::AddDirectory()as suggested in ReplaceTH1::AddDirectorybyTDirectory::TContext#21523 ?Note: No need to review until the following PRs are merged:
gDirectory, use TContext instead. #21287TH1::AddDirectorybyTDirectory::TContext#21523